<script setup>
import WuXing from './components/WuXing.vue'
import { onMounted } from 'vue'

// 创建星空背景效果
onMounted(() => {
  const starsContainer = document.createElement('div')
  starsContainer.className = 'stars'
  document.body.appendChild(starsContainer)
  
  // 创建星星
  for (let i = 0; i < 100; i++) {
    const star = document.createElement('div')
    star.className = 'star'
    star.style.left = `${Math.random() * 100}%`
    star.style.top = `${Math.random() * 100}%`
    star.style.width = `${Math.random() * 3}px`
    star.style.height = star.style.width
    star.style.setProperty('--duration', `${Math.random() * 5 + 3}s`)
    starsContainer.appendChild(star)
  }
})
</script>

<template>
  <div class="app-container">
    <div class="header">
      <div class="logo">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="60" height="60">
          <circle cx="50" cy="50" r="45" fill="none" stroke="#fff" stroke-width="2"/>
          <path d="M50,5 A45,45 0 0,1 50,95 A22.5,22.5 0 0,1 50,50 A22.5,22.5 0 0,0 50,5" fill="#fff"/>
          <circle cx="50" cy="35" r="5" fill="#000"/>
          <circle cx="50" cy="65" r="5" fill="#fff"/>
        </svg>
      </div>
      <h1 class="title">五行性格测试</h1>
      <p class="subtitle">探寻命中五行，揭示性格特征</p>
    </div>
    <WuXing/>
    <div class="footer">
      <p>© 2018-{{ new Date().getFullYear()}} 五行性格测试 - 探索命中玄机</p>
    </div>
  </div>
</template>

<style scoped>
/* 替换现有的.app-container样式 */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* PC端保留padding */
@media (min-width: 769px) {
  .app-container {
    padding: 20px;
  }
}

/* 移动端移除padding */
@media (max-width: 768px) {
  .app-container {
    padding: 0;
    max-width: 100vw;
  }
  
  .header {
    padding: 15px 10px; /* 移动端减小header内边距 */
    margin-bottom: 20px;
  }
  
  .title {
    font-size: 2rem; /* 移动端减小标题字体 */
  }
  
  .subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 0;
  }
  
  .header {
    padding: 10px 5px;
    margin-bottom: 15px;
  }
  
  .title {
    font-size: 1.8rem;
  }
  
  .footer {
    margin-top: 20px;
    padding: 0 10px;
  }
}

.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  position: relative;
}

.header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffd700, transparent);
}

.logo {
  margin-bottom: 15px;
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 2.5rem;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  margin-bottom: 10px;
}

.subtitle {
  font-family: 'Zhi Mang Xing', cursive;
  font-size: 1.2rem;
  color: #fff;
  opacity: 0.8;
}

.footer {
  margin-top: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}
</style>
